<script setup>
import PlanChart from './PlanChart.vue';

// 定义props
const props = defineProps({
  lineId: {
    type: String,
    required: true
  },
  lineName: {
    type: String,
    required: true
  },
  weeklyPlan: {
    type: Object,
    required: true,
  },
  dailyPlan: {
    type: Object,
    required: true,
  }
});
</script>

<template>
  <div class="production-line">
    <h2 class="line-title">{{ lineName }}</h2>
    <div class="plans-container">
      <div class="plan-wrapper">
        <PlanChart 
          title="周计划 Weekly plan" 
          :dataItems="weeklyPlan.dataItems" 
          :completionRate="weeklyPlan.completionRate" 
        />
      </div>
      <div class="plan-wrapper">
        <PlanChart 
          title="日计划 Daily plan" 
          :dataItems="dailyPlan.dataItems" 
          :completionRate="dailyPlan.completionRate" 
        />
      </div>
    </div>
  </div>
</template>

<style scoped>
.production-line {
  margin-bottom: 20px;
  width: 100%;
  border: 2px solid #5e5e5e;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 0 10px rgba(147, 147, 147, 0.3);
  transition: all 0.3s ease; 
}

.line-title {
  font-size: 30px;
  text-align: center;
  margin: 0px;
}

.plans-container {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.plan-wrapper {
  flex: 1;
  min-width: 0;
}

@media (max-width: 950px) {
  .plans-container {
    flex-direction: column;
  }
  
  .plan-wrapper {
    width: 100%;
  }
}
</style>